package com.itheima02.thread;

public class Demo1_Thread {
    public static void main(String[] args) {
        ThreadDemo threadDemo = new ThreadDemo();
        threadDemo.setName("线程1");//创建线程名称
        threadDemo.start();//开启线程

        ThreadDemo threadDemo2 = new ThreadDemo();
        threadDemo2.setName("线程2");
        threadDemo2.start();
    }
}

class ThreadDemo extends Thread {

    @Override
    public void run() {
        for (int i = 1; i <= 10; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
        }
    }
}
